﻿@model loveyou.Models.ViewData.Client_ListVD
@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <title>List</title>
    <script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")" type="text/javascript"></script>
    <script type="text/javascript" language="javascript">
        function changeController(obj, userName) {
            $.get('@(Url.Action("ChangeController", "ClientAgent"))', { isController: $(obj).is(":checked"), userName: userName }, function (result) {

            });
        }
    </script>
</head>
<body>
    <table>
        <thead>
            <tr>
                <th>
                    #
                </th>
                <th>
                    授权
                </th>
                <th>
                    用户名
                </th>
                <th>
                    设备
                </th>
            </tr>
        </thead>
        <tbody>
            @{ var i = 1;}
            @foreach (var item in Model.UserInfoList)
            {
                <tr>
                    <td>@(i++)
                    </td>
                    <td>
                        <input type="checkbox" @(item.IsController ? "checked" : "") onclick="changeController(this,'@item.UserName');"/>
                    </td>
                    <td>@item.UserName
                    </td>
                    <td>@item.DeviceKey
                    </td>
                </tr>
            }
        </tbody>
    </table>
</body>
</html>
